package com.michael.study.jetpack.db

import android.content.Context
import androidx.room.Room

/**
 * Description:
 *
 * Created by liuguoquan on 2020/6/29 14:06.
 */
class DBRoom {

    companion object {

        private var instance: AppDataBase? = null

        fun getDataBase(context: Context): AppDataBase {
            instance?.let {
                return it
            }
            return Room.databaseBuilder(
                context.applicationContext,
                AppDataBase::class.java,
                "app_db"
            ).allowMainThreadQueries().build().apply {
                instance = this
            }
        }


    }

}